*******************************************************
*** TREATY COUNT REPLICATION FILE *********************
*******************************************************
* Purpose:
* This do-file replicates treaty count tables for the appendix.
* Generates Table 1 and Table 1.2 from the same preprocessing.
* Note Table 1
*******************************************************

*------------------------------------------------------*
* Load treaty-level dataset and preprocess
*------------------------------------------------------*
use "treaty_info.dta", clear
*adjust file path as needed


*******************************************************
*** Table 1: Treaty Information Provision Types and Members 
*******************************************************
* Generate treaty type labels
gen treaty_type = ""
replace treaty_type = "Low Monitoring" if DVtypeALT == 1
replace treaty_type = "High Monitoring" if DVtypeALT == 2
replace treaty_type = "No Treaty" if DVtypeALT == 0
drop if treaty_type == ""

* Participation size categories
gen treaty_size = ""
replace treaty_size = "Bilateral" if Ncountries == 2
replace treaty_size = "Small Multilateral" if Ncountries > 2 & Ncountries <= 9
replace treaty_size = "Large Multilateral" if Ncountries >= 10

* Collapse for Table 1
preserve
collapse (count) treaty_count = DVtypeALT, by(treaty_type treaty_size)
list   // shows the collapsed results immediately
restore

*******************************************************
*** Table 1.2: Number of treaties by information provision types
*******************************************************

* Information type categories
gen info_provisions = ""
replace info_provisions = "None"        if treaty_type == "Low Monitoring" & dv_none == 1
replace info_provisions = "Reporting"   if treaty_type == "Low Monitoring" & dv_rep  == 1
replace info_provisions = "Monitoring"  if treaty_type == "High Monitoring" & dv_obs == 1
replace info_provisions = "Verification" if treaty_type == "High Monitoring" & dv_ver == 1

* Collapse for Table 1.2 and view directly
preserve
collapse (count) treaty_count2 = DVtypeALT, by(treaty_type info_provisions)
list        // shows the collapsed results immediately
restore

